import { BrowserRouter, Route, Link, Switch} from "react-router-dom";
import React, { Component } from 'react';
import routers from './routerConfig'
import {Home} from '@src/router/routerImport'
export default class RouterMap extends React.Component {
    render() {
        return (
            <BrowserRouter>
            <div>
                <Switch>
                    {
                        routers.map((route, index) => (
                            <RouteWithSubROutes key={index} {...route} />
                        ))
                    }
                </Switch>
            </div>
            </BrowserRouter>
        )
    }
}


const RouteWithSubROutes = (route) => {
    return (
        <Route 
            path={route.path}
            render={ props => {
                return <route.component {...props}  />
            }}
        />
    )
}